package com.wbk.lotteryweb.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@EnableWebMvc
@Configuration
public class MyConfig implements WebMvcConfigurer {

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/css/**").addResourceLocations("classpath:/static/css/");
        registry.addResourceHandler("/fonts/**").addResourceLocations("classpath:/static/fonts/");
        registry.addResourceHandler("/img/**").addResourceLocations("classpath:/static/img/");
        registry.addResourceHandler("/js/**").addResourceLocations("classpath:/static/js/");
    }

    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
        registry.addViewController("/index").setViewName("/index");
        registry.addViewController("/login").setViewName("/login");
        registry.addViewController("/register").setViewName("/register");
        registry.addViewController("/forgot-password").setViewName("/forgot-password");
        registry.addViewController("/about").setViewName("/about");
        registry.addViewController("/activity").setViewName("/activity");
        registry.addViewController("/activity-details").setViewName("/activity-details");
        registry.addViewController("/contact").setViewName("/contact");

        registry.addViewController("/my-profile").setViewName("/personal/my-profile");
        registry.addViewController("/my-properties").setViewName("/personal/my-properties");
        registry.addViewController("/submit-property").setViewName("/personal/submit-property");

        registry.addViewController("/lottery").setViewName("/lottery");
        registry.addViewController("/lottery_management").setViewName("/store/lottery_management");

        registry.addViewController("/").setViewName("/a");
    }
}
